package cn.edu.nhic.order;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import cn.edu.nhic.order.bean.FoodBean;

/**
 * 商品详情页
 */
public class FoodActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_food);
        //从当前活动中获取Intent
        Intent fdIntent=getIntent();
        //在intent中获取传递过来的foodbean对象实例数据
        FoodBean foodBean=(FoodBean) fdIntent.getSerializableExtra("food");

        ImageView iv_food_pic=this.findViewById(R.id.iv_food_pic);
        TextView tv_food_name=this.findViewById(R.id.tv_food_name);
        TextView tv_sale_num=this.findViewById(R.id.tv_sale_num);
        TextView tv_price=this.findViewById(R.id.tv_price);

        tv_food_name.setText(foodBean.getFoodName());
        tv_sale_num.setText(foodBean.getSaleNum());
        tv_price.setText("￥"+foodBean.getPrice());
        //加载图片  当前图片是网络地址
        Glide.with(this)
                .load(foodBean.getFoodPic())
                .into(iv_food_pic);
    }
}